<?php
namespace models\dao;

use models\dao\GenericDAO;
class UsuarioDAO extends GenericDAO {

	public function __construct($em) {
		parent::__construct($em);
	}

	public function findByPrimaryKey($id) {
		return parent::findByPrimaryKey('models\Usuario', $id);
	}

	public function save($usuario) {
		parent::save($usuario);
	}

	public function delete($usuario) {
		parent::delete($usuario);
	}

	public function findAll() {
		return parent::findAll('models\Usuario');
	}

	public function login($email, $senha) {
		$query = $this->entityManager->
						createQuery("SELECT u FROM models\Usuario u WHERE u.email = '$email' AND u.senha = '$senha' ");
		return $query->getResult();
	}
}